None Notebook

This notebook contains material from cbe61622; content is available on Github.

< 10.10 Computer Vision Case Study: Introduction | Contents | 10.12 Computer Vision Case Study: Creating an Application >

Open in Colab

Download

10.11 Computer Vision Case Study: Finding Particles in Images

10.11.1 Developing a Process

Our approach ...

10.11.1.1 Python Imports

We track overall code dependencies by consolidating imports into this cell. Note that we'll be using elements from multiple packages by relying on the underlying NumPy representation of images to hold the current state of the process.

10.11.1.2 Reading images

As a first step, read the image, convert to rgb scale, and display. All of these packages have a means of reading raster file images in common formats. There are small (and sometimes frustrating) differences among them. Here we use the Matplotlib imread() method which reads and returns a numpy array.

The array will typical have 2 or 3 dimensions $(h, w, d)$ where $h$ and $w$ are image height and width, and $d$ is pixel depth.

Observations:

10.11.1.3 Cropping

10.11.1.4 Channels and Histograms

An image is comprised of one or more channels

Histograms are a tool for analyzing the distribution of gray levels in a channel. It's a powerful tool for controlling exposure and processing images for presentation.

10.11.1.5 Creating a composite channel

We see the blue leds used to excite the flourophores bleed over into the green channel. It would be best if this could be corrected in the experiment, perhaps by positioning a bandpass filter in front of the leds. What we will attempt here is subtract a multiple of blue channel from the green channel, followed by exposure adjustments. The goal is to provide a cleaner image for doing particle labeling and counting.

By trial and error, we find a weighted difference of the green and blue channels, and a rescaling of the tone curve that retains the particles and reduces background interference.

10.11.1.6 Histogram equalization

At this stage our composite image appears significantly underexposed. Looking at just the green channel, increasing the exposure 4x, or even 6x, would significantly brighten the particles that we're seeking to detect. In future versions of the experiment it may be useful to experiment with signficantly brighter lenses, light sources, or longer exposures.

In the meanwhile, the step in image processing is to equalize the histogram to improve opportunities for effective particle detection.

Observations

10.11.1.7 Blur filter

10.11.1.8 Thresholding/Segmentation

The purpose of threshold is to isolate the features of interest from background noise.

https://docs.opencv.org/3.4/d7/d4d/tutorial_py_thresholding.html

10.11.1.9 Morphological Transformation

The next goal is to remove noise and to separate particles.

10.11.1.10 Finding Objects

http://pageperso.lif.univ-mrs.fr/~francois.denis/IAAM1/scipy-html-1.0.0/tutorial/ndimage.html

10.11.1.11 Finding and Displaying Particles

10.11.1.12 Creating a Training Set

10.11.1.13 What did we learn about our application?

10.11.2 Particle Labeling Classes

To facilitate embedded use in a device, the next step is to consolidate these procedures into a class.

10.11.3 Demonstrations

10.11.3.1 Thresholding

< 10.10 Computer Vision Case Study: Introduction | Contents | 10.12 Computer Vision Case Study: Creating an Application >

Open in Colab

Download